local Lua__luguan = fk.CreateSkill {

  name = "Lua__luguan",

}

Fk:loadTranslationTable{
    ["Lua__luguan"] = "鹿管",
    ["#Lua__luguanActive"] = "鹿管",
    ["#Lua__luguan"] = "鹿管：你可以流失一点体力并对一名角色造成两点伤害",
    [":Lua__luguan"] = "回合技，出牌阶段或你受到伤害时，你可以流失一点体力对一名其他角色造成两点伤害。",
    ["#luguan-target"] = "鹿管：选择一名角色，对其造成两点伤害",

}

Lua__luguan:addEffect("active", {
    anim_type = "offensive",
    prompt = "#Lua__luguan",
    card_num = 0,
    target_num = 1,
    can_use = function(self, player)
        -- 雄伟触发后无次数限制
          if player:getMark("@@xiongwei") == 0 then
            return player:usedSkillTimes(Lua__luguan.name, Player.HistoryTurn) == 0 
          else
            return true
          end
    end,
    card_filter = Util.FalseFunc,
    target_filter = function(self, player, to_select, selected)
        return #selected == 0 and to_select ~= player
    end,
    on_use = function(self, room, effect)
        local player = effect.from
        local target = effect.tos[1]
        -- 流失体力
        room:loseHp(player, 1, "Lua__luguan")
        -- 造成伤害
        room:damage({
            from = player,
            to = target,
            damage = 2,
            skillName = "Lua__luguan",
        })
    end,
})

Lua__luguan:addEffect(fk.DamageInflicted, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(Lua__luguan.name) then
      if player:getMark("@@xiongwei") == 0 then
        return player:usedSkillTimes(Lua__luguan.name, Player.HistoryTurn) == 0 
      else
        return true
      end
    end
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local to = room:askToChoosePlayers(player, {
      targets = room:getOtherPlayers(player),
      min_num = 1,
      max_num = 1,
      prompt = "#luguan-target",
      skill_name = Lua__luguan.name,
      cancelable = true,
    })
    if #to > 0 then
      event:setCostData(self, {target = to[1]})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
      local room = player.room
      local target = event:getCostData(self).target
      room:loseHp(player, 1, Lua__luguan.name)
      -- 造成伤害
      room:damage({
        from = player,
        to = target,
        damage = 2,
        skillName = Lua__luguan.name,
      })
  end,
})

return Lua__luguan